﻿using System;
using System.Collections.Generic;

namespace _1436_destination_city
{
    class Program
    {
        static void Main (string[] args)
        {
            List<List<string>> paths = new List<List<string>>();
            paths.Add(new List<string> ());
            paths.Add (new List<string> ());
            paths.Add (new List<string> ());
            paths[0].Add ("b");
            paths[0].Add ("c");
            paths[1].Add ("d");
            paths[1].Add ("b");
            paths[2].Add ("c");
            paths[2].Add ("a");

            Console.WriteLine (DestCity(paths));
        }

        public static string DestCity (List<List<string>> paths)
        {
            string str = "";
            Dictionary<string, string> city = new Dictionary<string, string> ();
            for (int i = 0;i < paths.Count;i++)
            {
                city.Add (paths[i][0], paths[i][1]);
            }

            for (int i = 0;i < paths.Count;i++)
            {
                if (!city.ContainsKey (paths[i][1])) str = paths[i][1];
            }

            return str;
        }
    }
}
